package electricity.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import electricity.domain.RolePermission;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
/**
* @author haoyi
* @description 针对表【role_permission】的数据库操作Mapper
* @createDate 2025-07-09 16:01:31
* @Entity generator.domain.RolePermission
*/
public interface RolePermissionMapper extends BaseMapper<RolePermission> {

    int deleteByPrimaryKey(Long id);

    int insert(RolePermission record);

    int insertSelective(RolePermission record);

    RolePermission selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(RolePermission record);

    int updateByPrimaryKey(RolePermission record);
    /**
     * 根据角色ID删除关联的权限
     * @param roleId 角色ID
     */
    void deleteByRoleId(Integer roleId);

    /**
     * 根据角色ID查询关联的权限ID
     * @param roleId 角色ID
     * @return 权限ID列表
     */
    List<Integer> selectPermissionIdsByRoleId(Integer roleId);

    /**
     * 批量插入角色-权限关联
     * @param list 关联列表
     */
    void batchInsert(List<RolePermission> list);

}
